﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 坦克大战.Properties;

namespace 坦克大战
{
    internal class Exp:GameObject
    {
        public bool isDestory { get; set; }
        private int playSpeed = 1;
        private int playCount = 0;
        private int index = 0;
        private Bitmap[] bitmaps = new Bitmap[]
        {
            Resources.EXP1,
            Resources.EXP2,
            Resources.EXP3,
            Resources.EXP4,
            Resources.EXP5,


        };
        public Exp(int x,int y)
        {
            foreach(Bitmap bmp in bitmaps)
            {
                bmp.MakeTransparent(Color.Black);
            }
            this.X = x - bitmaps[0].Width / 2;
            this.Y = y - bitmaps[0].Height / 2;
            isDestory = false;

        }
        protected override Image GetImage()
        {
            //throw new NotImplementedException();
            if(index>4) return bitmaps[4];
            return bitmaps[index];
        }
        public override void Update()
        {
            playCount++;
            int index = (playCount - 1) / playSpeed;
            if(index>4)
            {
                isDestory=true;
            }
            base.Update();
        }
        //public override void DrawSelf()
        //{
        //    base.DrawSelf();

        //}

    }
}
